package io.renren.modules.factory.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.factory.dao.TFactoryRawMeterialDao;
import io.renren.modules.factory.entity.TFactoryRawMeterialEntity;
import io.renren.modules.factory.service.TFactoryRawMeterialService;


@Service("tFactoryRawMeterialService")
public class TFactoryRawMeterialServiceImpl extends ServiceImpl<TFactoryRawMeterialDao, TFactoryRawMeterialEntity> implements TFactoryRawMeterialService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TFactoryRawMeterialEntity> page = this.page(
                new Query<TFactoryRawMeterialEntity>().getPage(params),
                new QueryWrapper<TFactoryRawMeterialEntity>()
                        .eq("seller_id",params.get("sellerId"))
                .eq(!params.get("rawMaterialTypeId").equals("") , "raw_material_type_id",params.get("rawMaterialTypeId"))
                .like(!params.get("key").equals(""),"raw_material_name",params.get("key"))
        );

        return new PageUtils(page);
    }

}